def nextBeautifulNumber( n: int) -> int:
    ans = 0
    l = []
    for i in range(n + 1, 1224445):
        s = str(i)
        d = {}
        for c in s:
            if c not in d:
                d[c] = 1
            else:
                d[c] += 1
        flag = 0
        for j in d:
            if int(j) != d[j]:
                flag += 1
                break
        if flag != 0:
            continue
        else:
            l.append(i)
    print(l)
    return ans
a = nextBeautifulNumber(n = 0)
